package com.itheima.reggie.common;


import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author ：sean
 * @date ：Created in 2022/5/20
 * @description ：
 * @version: 1.0
 */
@WebFilter(filterName = "globalFilter",urlPatterns = "/*")
@Slf4j
public class GlobalFilter implements Filter {
	@Override
	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest)servletRequest;
		HttpServletResponse response = (HttpServletResponse)servletResponse;

		log.info("[全局过滤器，不做任何事情],uri:{}",request.getRequestURI());
		// doFilter，继续执行
		filterChain.doFilter(request,response);
	}

	@Override
	public void init(FilterConfig filterConfig) throws ServletException {

	}

	@Override
	public void destroy() {

	}
}
